<?php 	
class KeyjhmModel extends Model{
	///设置表名
	protected $trueTableName = 'jhm_key';
	
	//设置主键
	protected  $key = 'id';
	
	
		/**
		 * 
		 * 用户登陆
		 */
		public function checkLogin($key)
		{
			
			//密码加密
			$pass = md5($key);
			
			//校验查询
			$restul = $this->field('*')->where("`key`='{$pass}'")->find();
			
			if ( $restul['id'] == NULL ) return false;
			
			return $restul;
			
		}
		/**
		 * 更新一条数据
		 */
		public function update(array $data, $id)
		{
		
			//字段
			$field = array(
					'addtime',
					'isdl',
					'dy_ip',
					'dr_time',
					'zh_ip',
			);
		
			//字段过滤
			$data = $this->CheckField($data, $field);
		
			//条件
			$where = $this->key.'='.$id;
				
		
			return $this->where($where)->save($data);
		
		}
}
?>